/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.leadiv.ai.ga;

import java.util.Vector;

/**
 *
 * @author pborrego
 */
public class SGenome implements Comparable<SGenome> {
    public Vector<Double> vecWeights = new Vector<Double>();
    public double dFitness;
    
    public SGenome()
    {
        dFitness = 0;
    }
    
    public SGenome(Vector<Double> w, double f)
    {
        vecWeights = w;
        dFitness = f;
    }

    public int compareTo(SGenome rhs) {
        // throw new UnsupportedOperationException("Not supported yet.");
        
        if(dFitness == rhs.dFitness)
        {
            return 0;
        }
        
        return (dFitness > rhs.dFitness) ? 1 : -1;
    }

    // Compares lhs < rhs. Returns true if lhs is less then rhs.
    // The comparing function is now in SGenomeComparer class.
    // IN ORGINAL CODE THIS WAS AN OPERATOR OVERLOADED FUNCTION.
}